<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery.min.js"></script>
</head>
<body>
<form action="/ttt/Tbuser/save" method="post" id="form">
    <input type="text" id="uname" name="uname" placeholder="用户名">
    <input type="password" id="pwd" name="pwd" placeholder="密码">
    <input type="submit" value="提交">
</form>
<input type="button" onclick="tet()" value="添加">
<script>

    function tet(){
        var form=new FormData($("#form")[0]);
        $.ajax({
            url:"/demo/Tbuser/save",
            type:"post",
            data:form,
            dataType:"json",
            processData:false,
            contentType:false,
            success:function (res) {
                console.log(res);
            },
            error:function (msg) {
                console.log(msg.responseText)
            }
        });
    }

</script>
</body>
</html>